<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.webamc.common.enums.Fields" %>
<%@ page import="com.webamc.common.enums.Params" %>
<%@ page import="com.webamc.model.Customer" %>

<script type="text/javascript" src="../calendar.js" ></script>
<link rel="stylesheet" href="../webamc.css"/>
<div class="action-header">UPDATE CUSTOMER</div>
<jsp:include page="msgs.jsp"/>

<%
    Customer customer = (Customer) request.getAttribute(Params.BEAN);
    if (customer == null) {
%>
No customer! <a href="customer.html?action=browse">click here</a> to browse list.
<%
        return;
    }

    request.setAttribute(Params.PI, customer.getInfo());
%>

<form action="customer.html?action=update" method="post">
    <table class="browse-table" border="1">
        <col width="20%">
        <col width="80%">

        <tr>
            <td>CustomerId</td>
            <td><input readonly name="<%=Fields.CUSTOMERID%>" value="<%=customer.getCustomerId()%>"/></td>
        </tr>
        <tr>
            <td>Status</td>
            <td>
                <% request.setAttribute(Params.KEY, Fields.CUSTOMERSTATUS); %>
                <% request.setAttribute(Params.SEL, customer.getStatus()); %>
                <jsp:include page="combo-util.jsp" />
            </td>
        </tr>
        <tr>
            <td>Category</td>
            <td>
                <% request.setAttribute(Params.KEY, Fields.CUSTOMERCATEGORY); %>
                <% request.setAttribute(Params.SEL, customer.getCategory()); %>
                <jsp:include page="combo-util.jsp" />
            </td>
        </tr>

        <tr>
            <td>Personal Info</td>
            <td>
                <jsp:include page="updatepersonalinfo.jsp"/>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <button type="submit">OK</button>
                <a href="customer.html?action=view&<%=Fields.CUSTOMERID%>=<%=customer.getCustomerId()%>">
                    <button type="button">Cancel</button>
                </a>
            </td>
        </tr>
    </table>

</form>